//package com.github.thinwonton.example.apidoc.controller.order;
//
//import com.github.thinwonton.example.apidoc.common.Result;
//import com.github.thinwonton.example.apidoc.controller.order.param.OrderDTO;
//import com.github.thinwonton.example.apidoc.controller.order.param.OrderQuery;
//import com.github.thinwonton.example.apidoc.controller.order.param.QueryDTO;
//import com.github.thinwonton.example.apidoc.controller.order.vo.OrderDetail;
//import com.github.thinwonton.example.apidoc.controller.order.vo.OrderVO;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.Parameters;
//import io.swagger.v3.oas.annotations.enums.ParameterIn;
//import io.swagger.v3.oas.annotations.extensions.Extension;
//import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
//import io.swagger.v3.oas.annotations.media.Schema;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import jakarta.servlet.http.HttpServletRequest;
//import org.apache.commons.io.IOUtils;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.IOException;
//import java.nio.charset.StandardCharsets;
//import java.util.Date;
//import java.util.Optional;
//
///**
// * 此文件中的接口会跟OrderDetailController中的接口合并到一个文件夹下，只要@Api.value一致就行
// *
// * @author tanghc
// */
//public class OrderController extends OrderBaseController {
//
//    @Operation(summary = "提交订单信息，application/json", description = "提交订单信息，application/json", extensions = {
//            // 指定维护人
//            @Extension(name = "author", properties = {
//                    @ExtensionProperty(name = "Tom", value = "")
//            }),
//            // 指定错误码
//            @Extension(name = "code", properties = {
//                    @ExtensionProperty(name = "100001", value = "id错误"),
//                    @ExtensionProperty(name = "100002", value = "错误描述2"),
//                    @ExtensionProperty(name = "100003", value = "错误描述3")
//            })
//    })
//    @PostMapping("create")
//    public Result<OrderDTO> create(@RequestBody OrderDTO orderDTO) {
//        return Result.ok(orderDTO);
//    }
//
//    @Operation(summary = "提交订单信息，application/x-www-form-urlencoded", description = "提交订单信息，application/x-www-form-urlencoded")
//    @PostMapping("create2")
//    public Result<OrderDTO> create2(OrderDTO orderDTO) {
//        return Result.ok(orderDTO);
//    }
//
//    @Operation(summary = "演示query参数,不加@RequestParam", description = "演示query参数,不加@RequestParam")
//    @GetMapping("get")
//    public Result<OrderDetail> get(
//            @Schema(description = "订单id", example = "xxx", required = true)
//            String orderNo
//    ) {
//        OrderDetail orderDetail = new OrderDetail();
//        orderDetail.setOrderNo(orderNo);
//        orderDetail.setUserId(11L);
//        orderDetail.setPayTime(new Date());
//        return Result.ok(orderDetail);
//    }
//
//    @Operation(summary = "演示query参数,加@RequestParam", description = "演示query参数,加@RequestParam")
//    @GetMapping("get2")
//    public Result<OrderDetail> get2(
//            @Schema(description = "订单id", example = "xxx")
//            @RequestParam String orderNo
//    ) {
//        OrderDetail orderDetail = new OrderDetail();
//        orderDetail.setOrderNo(orderNo);
//        orderDetail.setUserId(11L);
//        orderDetail.setPayTime(new Date());
//        return Result.ok(orderDetail);
//    }
//
//    @Operation(summary = "演示query参数,放在对象里面")
//    @GetMapping("get4")
//    public Result<OrderDetail> get4(OrderQuery orderQuery) {
//        OrderDetail orderDetail = new OrderDetail();
//        orderDetail.setOrderNo("orderQuery:" + orderQuery);
//        orderDetail.setUserId(11L);
//        orderDetail.setPayTime(new Date());
//        return Result.ok(orderDetail);
//    }
//
//    @Operation(summary = "演示query参数,放在对象里面+外面一个")
//    @GetMapping("get5")
//    public Result<OrderDetail> get5(OrderQuery orderQuery,
//                                    @Schema(description = "产品id，外面的", example = "111")
//                                    String pid) {
//        OrderDetail orderDetail = new OrderDetail();
//        orderDetail.setOrderNo("orderQuery:" + orderQuery);
//        orderDetail.setUserId(11L);
//        orderDetail.setPayTime(new Date());
//        return Result.ok(orderDetail);
//    }
//
//
//    @Operation(summary = "演示path参数", description = "演示path参数")
//    @GetMapping("get/{orderNo}")
//    public Result<OrderDetail> get3(
//            @Schema(description = "订单id", example = "xxx")
//            @PathVariable String orderNo
//    ) {
//        OrderDetail orderDetail = new OrderDetail();
//        orderDetail.setOrderNo(orderNo);
//        orderDetail.setUserId(11L);
//        orderDetail.setPayTime(new Date());
//        return Result.ok(orderDetail);
//    }
//
//    @Operation(summary = "演示path参数+query参数+body参数+header", description = "提交订单信息说明。。")
//    @PostMapping("submit/{productNo}")
//    public Result<OrderVO> submit(
//            @RequestBody QueryDTO queryDTO,
//            @Schema(description = "查询id", example = "xx")
//            @RequestParam("qid") String qid,
//            @Schema(description = "产品id", example = "11")
//            @PathVariable Integer productNo,
//            @Schema(description = "token", example = "asdfe")
//            @RequestHeader("token") String token
//    ) {
//
//        OrderVO orderVO = new OrderVO();
//        orderVO.setOrderNo(queryDTO.getOrderNo());
//        StringBuilder sb = new StringBuilder()
//                .append("queryDTO=").append(queryDTO)
//                .append(", qid=").append(qid)
//                .append(", productNo=").append(productNo)
//                .append(", token=").append(token);
//        orderVO.setRemark(sb.toString());
//        return Result.ok(orderVO);
//    }
//
//
//    @Operation(summary = "全部参数json，全部由@ApiImplicitParams实现", description = "全部由@ApiImplicitParams实现")
//    /*
//        name：参数名
//        value：参数的说明、解释
//        required：参数是否必须传
//        paramType：参数放在哪个地方，详见：springfox.documentation.service.ParameterType
//            · header --> 请求参数的获取：@RequestHeader
//            · query --> 请求参数的获取：@RequestParam
//            · path（用于restful接口）--> 请求参数的获取：@PathVariable
//            · body（application/json）
//            · form（application/x-www-form-urlencoded）
//        dataType：参数类型，默认String，其它值dataType="Integer"
//        defaultValue：参数的默认值
//     */
//    @Parameters({
//            @Parameter(in = ParameterIn.PATH, name = "productNo", description = "产品id", schema = @Schema(type = "integer"), required = true, example = "11"),
//            @Parameter(in = ParameterIn.HEADER, name = "token", description = "token", schema = @Schema(type = "integer"), required = true, example = "asdfe"),
//            @Parameter(in = ParameterIn.QUERY, name = "qid", description = "查询id", schema = @Schema(type = "string"), required = true, example = "xx"),
//            @Parameter(name = "queryDTO", required = true, schema = @Schema(implementation = QueryDTO.class))
//    })
//    @PostMapping("submit2/{productNo}")
//    public Result<OrderVO> submit2(
//            @RequestBody QueryDTO queryDTO,
//            @RequestParam("qid") String qid,
//            @PathVariable Integer productNo,
//            @RequestHeader("token") String token
//    ) {
//        OrderVO orderVO = new OrderVO();
//        orderVO.setOrderNo(queryDTO.getOrderNo());
//        StringBuilder sb = new StringBuilder()
//                .append("queryDTO=").append(queryDTO)
//                .append(", qid=").append(qid)
//                .append(", productNo=").append(productNo)
//                .append(", token=").append(token);
//        orderVO.setRemark(sb.toString());
//        return Result.ok(orderVO);
//    }
//
//    @Parameters({
//            @Parameter(in = ParameterIn.PATH, name = "productNo", description = "产品id", schema = @Schema(type = "integer", required = true, example = "11")),
//            @Parameter(in = ParameterIn.HEADER, name = "token", description = "token", schema = @Schema(type = "string", required = true, example = "aaaa")),
//            @Parameter(in = ParameterIn.HEADER, name = "version", description = "version", schema = @Schema(type = "string", required = true, example = "bbbbb")),
//            @Parameter(in = ParameterIn.HEADER, name = "aa", description = "aa", schema = @Schema(type = "string", required = true, example = "cccc")),
//            @Parameter(in = ParameterIn.QUERY, name = "qid", description = "查询id", schema = @Schema(type = "string", required = true, example = "xx")),
//            @Parameter(name = "queryDTO", required = true, schema = @Schema(implementation = QueryDTO.class))
//    })
//    @Operation(summary = "全部参数form，全部由@ApiImplicitParams实现", description = "全部由@ApiImplicitParams实现")
//    @PostMapping("submit3/{productNo}")
//    public Result submit3(
//            QueryDTO queryDTO,
//            @RequestParam("qid") String qid,
//            @PathVariable Integer productNo,
//            @RequestHeader("token") String token,
//            @RequestHeader("version") String version,
//            @RequestHeader("aa") String aa,
//            HttpServletRequest request
//    ) {
//        try {
//            String body = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);
//            System.out.println("body:" + body);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        StringBuilder sb = new StringBuilder()
//                .append("queryDTO=").append(queryDTO)
//                .append(", qid=").append(qid)
//                .append(", productNo=").append(productNo)
//                .append(", token=").append(token);
//        return Result.ok(sb);
//    }
//
//    @Operation(summary = "全部参数upload，全部由@ApiImplicitParams实现", description = "全部由@ApiImplicitParams实现")
//    @Parameters({
//            @Parameter(in = ParameterIn.PATH, name = "productNo", description = "产品id", schema = @Schema(type = "integer", required = true, example = "11")),
//            @Parameter(in = ParameterIn.HEADER, name = "token", description = "token", schema = @Schema(type = "integer", required = true, example = "asdfe")),
//            @Parameter(in = ParameterIn.QUERY, name = "qid", description = "查询id", schema = @Schema(type = "string", required = true, example = "xx")),
//            @Parameter(name = "file", description = "文件", schema = @Schema(type = "file"), required = true)
//    })
//    @PostMapping("submit4/{productNo}")
//    public Result submit4(
//            MultipartFile file,
//            @RequestParam("qid") String qid,
//            @PathVariable Integer productNo,
//            @RequestHeader("token") String token
//    ) {
//        StringBuilder sb = new StringBuilder()
//                .append("file=").append(Optional.ofNullable(file).map(MultipartFile::getOriginalFilename).orElse(null))
//                .append(", qid=").append(qid)
//                .append(", productNo=").append(productNo)
//                .append(", token=").append(token);
//        return Result.ok(sb);
//    }
//
//
//}
